﻿using System;
using System.Windows.Forms;
using Sumen.Business;
using Sumen.Business.Permission;
using Sumen.Business.Presenter.Sys;
using Sumen.Library.Enum;
using Sumen.Library.Froms;


namespace Sumen.GUI.Sumen_System
{
    public partial class Frm_Parameters : XtraUserControlKira
    {
        private EnumFormCode _fromCode = EnumFormCode.FrmParameter;
        public Frm_Parameters()
        {
            InitializeComponent();
            ucDanhMuc1.btnArray.capQuyen(new Permission(FormCode.ToString(), ClsPublic.User.User_Username));
            if (ClsPublic.SYSTEM_WRITELOG == "1")
            {
                SysLogPresenter log = new SysLogPresenter();
                log.Add(_fromCode, EnumFormStatus.View, "", "");
            }
            this.Disposed += Frm_Customer_Type_Disposed;
        }

        void Frm_Customer_Type_Disposed(object sender, System.EventArgs e)
        {
            ClsPublic.WriteLog(_fromCode, EnumFormStatus.Modify, "", "");
        }

        private void Frm_Parameters_Load(object sender, EventArgs e)
        {
            //ucDanhMuc1.gridView.Columns["Opt_Actived"].Visible = false;
        }

        private void Frm_Parameters_FormClosing(object sender, FormClosingEventArgs e)
        {
            if (ClsPublic.SYSTEM_WRITELOG == "1" && ucDanhMuc1.IsSave)
            {
                SysLogPresenter log = new SysLogPresenter();
                log.Add(_fromCode, EnumFormStatus.Modify, "", "");
            }
        }

        public override void Refresh()
        {
            base.Refresh();
            ucDanhMuc1.reLoad();
            ucDanhMuc1.reLoadParent();
        }

    }
}